<template>
  <div class="search">
    <f-form ref="form" :action="api.payment" :form-key="this.formItem.paymentId" >
      <f-form-item label="付款事项"  name="title"    :value="formItem.title" />
      <f-form-item label="单号"  name="paymentNo"    :value="formItem.paymentNo" />
      <f-form-item label="账套ID"  name="companyId"    :value="formItem.companyId" />
      <f-form-item label="机构ID"  name="organizationId"    :value="formItem.organizationId" />
      <f-form-item label="部门ID"  name="deptId"    :value="formItem.deptId" />
      <f-form-item label="资金类型"  name="amountType"    :value="formItem.amountType" />
      <f-form-item label="金额"  name="amount"    :value="formItem.amount" />
      <f-form-item label="收付款日期"  name="amountDate"    :value="formItem.amountDate" />
      <f-form-item label="收款银行账户"  name="bankId"    :value="formItem.bankId" />
      <f-form-item label="付款银行账户"  name="payBankId"    :value="formItem.payBankId" />
      <f-form-item label="状态0:未完成 1:已完成"  name="paymentState" dataType="number"   :value="formItem.paymentState" />
      <f-form-item label="申请人"  name="userId"    :value="formItem.userId" />
      <f-form-item label="购货方"  name="customId"    :value="formItem.customId" />
      <f-form-item label="供货方"  name="supplierId"    :value="formItem.supplierId" />
      <f-form-item label="单位名称"  name="bodyName"    :value="formItem.bodyName" />
      <f-form-item label="创建时间"  name="createTime"    :value="formItem.createTime" />
      <f-form-item label="更新时间"  name="updateTime"    :value="formItem.updateTime" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'paymentForm',
    props: {},
    data() {
      return {
        refs:this.$refs,
        api:  Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          paymentId: '',
          title: '',
          paymentNo: '',
          companyId: '',
          organizationId: '',
          deptId: '',
          amountType: '',
          amount: '',
          amountDate: '',
          bankId: '',
          payBankId: '',
          paymentState: '',
          userId: '',
          customId: '',
          supplierId: '',
          bodyName: '',
          createTime: '',
          updateTime: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.paymentId) {
          let params={
              paymentId:data.paymentId
          }
          this.refs['form'].getDetails(params,(data)=>{
             this.formItem=data
             this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
